import { createRouter, createWebHistory } from "vue-router";
import Home from "../views/Home/index.vue";
import UserCrud from "../views/Home/UserCrud/index.vue";
import Login from "../views/Login.vue";
import PersonalInfo from "../views/PersonalInfo/index.vue";
import Register from "../views/Register/index.vue";

const routes = [
  {
    path: "/",
    component: Home,
    meta: { title: "首页" },
    children: [
      {
        path: "user-crud",
        component: UserCrud,
        meta: { title: "用户管理-用户增删改查" },
      },
      { path: "personal-info", component: PersonalInfo, meta: { title: "个人信息" } },
    ],
  },
  { path: "/login", component: Login },
  { path: "/register", component: Register },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
